package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SegRegEmailInfo;
import com.ruoyi.system.service.ISegRegEmailInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 邮箱验证码表Controller
 * 
 * @author ruoyi
 * @date 2023-01-05
 */
@RestController
@RequestMapping("/arcus/RegMailInfo")
public class SegRegEmailInfoController extends BaseController
{
    @Autowired
    private ISegRegEmailInfoService segRegEmailInfoService;

    /**
     * 查询邮箱验证码表列表
     */
    @PreAuthorize("@ss.hasPermi('arcus:RegMailInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(SegRegEmailInfo segRegEmailInfo)
    {
        startPage();
        List<SegRegEmailInfo> list = segRegEmailInfoService.selectSegRegEmailInfoList(segRegEmailInfo);
        return getDataTable(list);
    }

    /**
     * 导出邮箱验证码表列表
     */
    @PreAuthorize("@ss.hasPermi('arcus:RegMailInfo:export')")
    @Log(title = "邮箱验证码表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SegRegEmailInfo segRegEmailInfo)
    {
        List<SegRegEmailInfo> list = segRegEmailInfoService.selectSegRegEmailInfoList(segRegEmailInfo);
        ExcelUtil<SegRegEmailInfo> util = new ExcelUtil<SegRegEmailInfo>(SegRegEmailInfo.class);
        util.exportExcel(response, list, "邮箱验证码表数据");
    }

    /**
     * 获取邮箱验证码表详细信息
     */
    @PreAuthorize("@ss.hasPermi('arcus:RegMailInfo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(segRegEmailInfoService.selectSegRegEmailInfoById(id));
    }

    /**
     * 新增邮箱验证码表
     */
    @PreAuthorize("@ss.hasPermi('arcus:RegMailInfo:add')")
    @Log(title = "邮箱验证码表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SegRegEmailInfo segRegEmailInfo)
    {
        return toAjax(segRegEmailInfoService.insertSegRegEmailInfo(segRegEmailInfo));
    }

    /**
     * 修改邮箱验证码表
     */
    @PreAuthorize("@ss.hasPermi('arcus:RegMailInfo:edit')")
    @Log(title = "邮箱验证码表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SegRegEmailInfo segRegEmailInfo)
    {
        return toAjax(segRegEmailInfoService.updateSegRegEmailInfo(segRegEmailInfo));
    }

    /**
     * 删除邮箱验证码表
     */
    @PreAuthorize("@ss.hasPermi('arcus:RegMailInfo:remove')")
    @Log(title = "邮箱验证码表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(segRegEmailInfoService.deleteSegRegEmailInfoByIds(ids));
    }
}
